package com.ts.test;

import com.gitee.apanlh.util.algorithm.encrypt.symmetric.AES;
import com.gitee.apanlh.util.encode.HexUtils;
import com.ts.api.module.api.convert.platform.adapter.ApiPlatformPhoneMd5Adapter;
import com.ts.api.module.api.entity.ApiUserRequest;

/**
 *
 *  @author Pan
 */
public class PlatFormDecrypt {

    static final String KEY = "4987cd682c336e06142f2eb0722dfc05e5741c42df6171067c7c118d297743cc";
    static final String PARAM = "9c351566689e3d455d523320a160510a6af65715548197ba919d90e2d0fa1b7a2476f29ad281864dc487debb8ecf30d0b90fe6f4d8da8205780e05dfc7cbd4105deef53aa82fa3e1b1783f16debb771ef0cca64ca488109522e0bfad83e4bd781208f2da687db9235230c0b9a3918351f36617e6a31bd5888a6ee36109d53ffb35af013d3a5688db3fbd2c3fca459d361e9143f1f0981fece35d044708a62870dcc6c9b327a3a15cd1c74629b2f069acb92071bd6ca4391c642addfcacf92fa5f34d0c4c37d3ae2d95602b096c59de3e5ed0f7b1ccd351d393dc3ba364719a17d77f55aff9a1cec7d2121b2af1e4ebfb0d86ce171d94c74bc536b3b608724453fa2c9b74f57a0e842fe6948767a614ac9fa43ea652515a44fcd536e230087c099f5c9048b2d813228562b54d6912300fe49ea70025f5dc99cfb4ce124fded64d8d91758c0855a376f2964f39d37748d7a04a58966a4409000d9de8014e93ec669ed12c76402664424dec341c430d427eae832b3ed10041d0b43dbad378dab339975e24de48b2c30b8b1cbb94054467a4fb22763a4217c281122d1edf02fb5bdc1ceaca4e06bbaa9d557729eb2d878b393cf66b0017ae0530923d71101efa05664b9868c24891b4c1880f5e62521d8f083169b36b6be11f917e11d6201e9d754f566c00a2a0e55309f9a2b68d86109b3a";

    public static String decrypt() {
        AES aes = new AES(HexUtils.decode(KEY));
        String decrypt = aes.decryptFromHexStr(PARAM);
        System.out.println("解密参数:" + decrypt);
        return decrypt;
    }

    public static String encrypt() {
        AES aes = new AES(HexUtils.decode(KEY));
        ApiPlatformPhoneMd5Adapter apiDefaultPlatform = new ApiPlatformPhoneMd5Adapter();
        ApiUserRequest apiUserRequest = new ApiUserRequest();
        apiUserRequest.setCity("杭州市");
        apiUserRequest.setPhone("18612341234");
        apiUserRequest.setPhoneMd5("");
        apiUserRequest.setUserName("测试");

//        apiDefaultPlatform.dataChange();

        String encrypt = aes.encryptToHex(PARAM);
        System.out.println("加密参数:" + encrypt);
        return encrypt;
    }

    public static void main(String[] args) {
//        String encrypt = encrypt();

    }
}
